package com.hsylient.demo06;

import com.hsylient.demo04.JdbcUtil;
import lombok.SneakyThrows;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;

public class TestResultMetaData {

    @SneakyThrows
    public static void main(String[] args) {
        Connection connection = JdbcUtil.getConnection();
        String sql = "select * from test.user";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        ResultSet resultSet = preparedStatement.executeQuery();
        ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
        System.out.println(resultSetMetaData.getCatalogName(1));
        System.out.println(resultSetMetaData.getColumnClassName(1));
        System.out.println(resultSetMetaData.getColumnCount());
        System.out.println(resultSetMetaData.getColumnLabel(1));
        System.out.println(resultSetMetaData.getColumnName(1));
        System.out.println(resultSetMetaData.getColumnType(1));
    }
}
